<!DOCTYPE html>
<html ng-app="myApp">
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/angular.js"></script>
	</head>
	<body ng-controller="searchtest">
		 <div class="search radius6">
                <form name="searchform" ng-submit="search()" >
                	<table cellspacing="" cellpadding="" style="width:600px ;  border-collapse:   separate;   border-spacing:   10px; float:left; ">
                		<tr>
                			<td style="width: 50%;">电话号码: 
                			<input  name="customerphone" id="customerphone"  ng-model="customerphone"/></td>
                			<td>客户姓名: <input name="customername" id="customername"  ng-model="customername"/></td>
                		</tr>
                		<tr>
                			<td>添加坐席:
                				<select style="width:143px" name="classid" id="choose" class="SelectList" ng-model="agent" ng-options="agent.extension for agent in agents"></select>	     
                			</td>
                			<td>添加时间: <input name="addtime" id="addtime" ng-model="customeraddtime"/></td>
                		</tr>
                	</table>
                    <input class="btn_srh" type="submit" name="submit"id="but"  value="查询" style="float: left;margin-top: 20px;">
                </form>
          
            </div>
            <script>
            	angular.module('myApp',[])
            		.controller('searchtest',['$scope','$window',function($scope,$window){
          
            			$scope.agents=[
            			{ extension: ' all', agentName: ' ' },
            			{ extension: '801', agentName: 'aa' },
            			{ extension: '802', agentName: 'bb' },
            			{ extension: '803', agentName: 'cc' },
            			{ extension: '680', agentName: 'dd' }
            			];
            			$scope.agent=$scope.agents[0];//select赋初值
            			//$scope.agent=document.getElementById('choose').value;
            			$scope.BindEnter=function(e){
            				// var keycode = window.event?e.keyCode:e.which;
            				if (e.keyCode == 13) {
                            	$scope.search();
                             }
                    
                         } 
            		
            			$scope.search=function(){
            			
            			var phone=$scope.customerphone;
            			var name=$scope.customername;
            			var agent=$scope.agent.extension;//获取select选择的值
            			var time=$scope.customeraddtime;
            			console.log(phone);
            			console.log(name);
            			console.log(agent);
            			console.log(time);
            			};
            		/*	ng-keyup="BindEnter($event)"
            		 * angular.element(window).keypress(function (event) {
                          event = event.which;
                         if (event == 13) {
                             $scope.search();
                                    }
                          });*/
            	
            		}])
            </script>
	</body>
</html>
